<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- AUTHOR: Dakota -->
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      >
    <body>
        <ui:composition>
            <h:form>
                <h:panelGrid id="completeGrid" columns="3">
                    <h:outputText value="Choose an Exercise (assigned by instructor):"/>
                    <h:selectOneMenu id="exerciselist" value="#{completeExerciseBean.assignedItem}"  >  
                        <f:selectItems value="#{completeExerciseBean.assignedValue}"/>
                    </h:selectOneMenu>
                    <p:commandButton value="Choose&nbsp;an&nbsp;Exercise" process="@form" update=":tabForm:growl descSource runPanel" action="#{completeExerciseBean.chooseExercise}"/>
                </h:panelGrid> 
                <p:outputPanel id="descSource" >
                    <h:panelGrid columns="2" style=" margin-left: 60%;" rendered="#{completeExerciseBean.isSet}">
                        <h:outputText value="Current Score: " />
                        <p:inputText readonly="true" value="#{completeExerciseBean.score}"/>
                    </h:panelGrid>
                    <p:fieldset legend="Description" style=" width: 60%;"  rendered="#{completeExerciseBean.isSet}">
                        <h:outputText value="#{completeExerciseBean.assignment.exerciseDescription}" style="padding-top:30px; padding-bottom:30px; margin-bottom: 30px;" />
                    </p:fieldset>
                    <p:fieldset legend="Source Code" style="margin-top: 30px; width: 60%" rendered="#{completeExerciseBean.isSet}">
                        <p:inputTextarea id="exerciseinput" value ="#{completeExerciseBean.content}" rows="20" style="width: 100%;"  autoResize="true" />
                    </p:fieldset>
                    <p:commandButton value="Save/Compile/Run" process="@form" update=":tabForm:stickygrowl :tabForm:growl descSource runPanel :tabForm" action="#{completeExerciseBean.compileSaveRunCode}" rendered="#{completeExerciseBean.isSet}" />
                </p:outputPanel>
                
                <p:outputPanel id="runPanel">
                    <p:fieldset legend="Run Output" rendered="#{completeExerciseBean.isExecuted}" style="margin-top: 30px;">
                        <h:outputText value="#{completeExerciseBean.run1}" escape="false" />
                        <h:outputText value="#{completeExerciseBean.run2}" escape="false" />
                        <h:outputText value="#{completeExerciseBean.run3}" escape="false" />                  
                    </p:fieldset>
                </p:outputPanel>
            </h:form>
        </ui:composition>
    </body>
</html>
